package com.sxt;

import javax.swing.*;
import java.awt.*;

//绘制金块类
public class Gold extends Object {
    //定义初始状态为false，为金块添加标记，防止勾住一个金块所有金块全部消失
    boolean flag = false;
    //写一个gold的无参构造
    public Gold() {
        this.x = (int)(Math.random()*900);
        this.y = (int)(Math.random()*380+150);
        this.width = 60;
        this.height = 60;
        this.m = 30;
        this.count = 3;
        //因为mini与plus都继承gold，所以下方不用再继续编写
        this.type = 1;
        this.flag = false;
        this.image = Toolkit.getDefaultToolkit().getImage("image/gold1.gif");
    }
}
//构建一个goldmini类直接继承gold类简化代码
class GoldMini extends Gold {
    GoldMini() {
        this.width = 30;
        this.height = 30;
        this.m = 15;
        this.count = 2;
        this.image = Toolkit.getDefaultToolkit().getImage("image/gold0.gif");
    }
}
//构建一个goldplus类直接继承gold类简化代码
class Goldplus extends Gold {
    Goldplus() {
        this.x = (int)(Math.random()*780);
        this.width = 120;
        this.height = 119;
        this.m = 45;
        this.count = 4;
        this.image = Toolkit.getDefaultToolkit().getImage("image/gold2.gif");
    }
}
